--- giblib-1.2.4/configure.ac.dist	2022-06-03 02:18:31.377935260 -0400
+++ giblib-1.2.4/configure.ac	2022-06-03 02:19:07.737316688 -0400
@@ -17,16 +17,7 @@
 AM_MAINTAINER_MODE
 AM_WITH_DMALLOC
 
-AC_PATH_GENERIC(imlib2, 1.0.0, [
-  AC_SUBST(IMLIB_LIBS)
-  AC_SUBST(IMLIB_CFLAGS) ],
-  AC_MSG_ERROR(Cannot find imlib2: Is imlib2-config in the path?) )
-
-dnl the above doesn't work for some reason :/
-IMLIB_LIBS=`imlib2-config --libs`
-IMLIB_CFLAGS=`imlib2-config --cflags`
-AC_SUBST(IMLIB_LIBS)
-AC_SUBST(IMLIB_CFLAGS)
+PKG_CHECK_MODULES([IMLIB],[imlib2])
 
 LIBS="$LIBS -lm"
 CFLAGS="$CFLAGS -Wall"
